import sorting_functions
import pylab


def plot_similarity(codebook_list, new_fig=False):
    r = range(2,len(codebook_list)+2)
    ses = []
    if new_fig:
        pylab.figure()
    for cb in codebook_list:
        ses.append( sorting_functions.similarity(cb) )
    pylab.title('Similarity index for various numbers of clusters.')
    pylab.plot(r,ses)
    pylab.xlabel('k (number of clusters)')
    pylab.ylabel('Similarity')
